import wx
from wx.richtext import RichTextCtrl

class ConsolePanel(wx.Panel):
    """"
    This class represents the console panel. It provides results of acceptance tests.
    @author: Mikaela Maia
    """    
    def __init__(self, parent, id):
         wx.Panel.__init__(self, parent, id, size=wx.Size(500, 400))
         self.SetBackgroundColour(wx.WHITE)
         self.scrolledWindow = RichTextCtrl(self, -1)
         self.scrolledWindow.SetEditable(False)
         sizer = wx.BoxSizer(wx.VERTICAL)
         sizer.Add(self.scrolledWindow, 1, wx.EXPAND)
         self.SetSizer(sizer)

    def setResult(self,result):
        """This method sets the result of the console. """
        self.scrolledWindow.Clear()
        self.scrolledWindow.WriteText(result)

    def getResult(self):
        """This method returns the result of the console. """
        self.scrolledWindow.SelectAll()
        return self.scrolledWindow.GetStringSelection()    